var artistDesc;
var container;
$(function () {
    artistDesc = new Vue({
        el:'#artistDescController',
        data:{
            item:{},
            arts:[]
        },
        methods:{
            loadData:function () {
                var that = this;
                sy.post('/web/artist/detail',{
                    id:_id
                },function (data) {
                    if (data.code == 0){
                        that.item = data.data;
                    }else{
                        sy.msg(data.msg);
                        location.href = history.go(-1);
                    }
                })
            },
            loadArts:function () {
              var that = this;
              sy.post('/web/art/listByArtist',{
                  artist:_id
              },function (data) {
                  if (data.code == 0){
                      that.arts = data.data;
                      Vue.nextTick(function () {
                          container.masonry('reload');
                      });
                  }
              })
            },
            focus:function () {
                var that = this;
                if (that.item.isFriend != 0){
                    sy.postApi('/api/user/delUserFocus',{
                        focusType:1,
                        id:that.item.id
                    },function (data) {
                        that.item.isFriend = 0;
                    })
                }else{
                    sy.postApi('/api/user/addUserFocus',{
                        focusType:1,
                        id:_id
                    },function (data) {
                        that.item.isFriend = 1;
                    })
                }

            }
        },
        created:function () {
            this.loadData();
            this.loadArts();
        },
        mounted:function () {
            tores();
            container = $('.waterfull ul');
            container.imagesLoaded(function(){
                container.masonry({
                    columnWidth: 320,
                    itemSelector : '.item',
                    isFitWidth: true,//是否根据浏览器窗口大小自动适应默认false
                    isAnimated: true,//是否采用jquery动画进行重拍版
                    isRTL:false,//设置布局的排列方式，即：定位砖块时，是从左向右排列还是从右向左排列。默认值为false，即从左向右
                    isResizable: true,//是否自动布局默认true
                    animationOptions: {
                        duration: 800,
                        easing: 'easeInOutBack',//如果你引用了jQeasing这里就可以添加对应的动态动画效果，如果没引用删除这行，默认是匀速变化
                        queue: false//是否队列，从一点填充瀑布流
                    }
                });
            });
        },
        updated:function () {

        }
    });
})